package org.example.Visitor;

import java.util.LinkedList;
import java.util.List;

/**
 * @author wangbin
 * @date 2024/4/19
 * @vesion 1.0
 */
public class ObjectStructure {

    private List<Person> personList =new LinkedList<>();

    public void attach(Person person){
        personList.add(person);
    }



    public void remove(Person person){
        personList.remove(person);
    }

    public void display(Action action){
        for (Person person:personList) {
            person.accept(action);
        }
    }
}
